using Unity.VisualScripting;
using UnityEngine;

public class LoveMan : Npc
{
    [Header("coll")]
    public GameObject collObj;
    [Header("对话类型1攻防=52")]
    public SayData sayData1;
    [Header("对话类型1攻=52")]
    public SayData sayData2;
    [Header("对话类型1防=52")]
    public SayData sayData3;
    [Header("对话类型1攻+防=52")]
    public SayData sayData4;
    [Header("好像都没有达到要求啊")]
    public SayData sayData5;
    [Header("对话类型1Abs(攻-防)=52")]
    public SayData sayData7;
    [Header("对话类型1生命值==520")]
    public SayData sayData8;
    [Header("领取了")]
    public SayData sayData6;
    private void Start()
    {
        collObj = transform.Find("CheckPosOne").gameObject;

        //隐藏
        collObj.GetComponent<Collider2D>().enabled = false;
    }
    private void OnMouseDown()
    {
        if (GameManager.Instance.canOprate==false) return;

        SceneItemManager.instance.clickEnemyRight = true;
        collObj.GetComponent<Collider2D>().enabled = true;
        SceneItemManager.instance.SetClickEnemy(gameObject);
    }
    //打开UI
    public void OpenLove()
    {
        Player player = GameManager.Instance.player;
        if(player.currHp==520)
        {
            sayData=sayData8;
        }
        else if(player.damage==52&&player.armor==52)
        {
            sayData=sayData1;
        }
        else if(player.damage==52)
        {
            sayData=sayData2;
        }
        else if (player.armor==52)
        {
            sayData=sayData3;
        }
        else if (player.damage+player.armor==52)
        {
            sayData=sayData4;
        }
        else if((player.damage-player.armor)==52)
        {
            sayData=sayData7;
        }
        else
        {
            sayData=sayData5;
        }

        sayData.myName=npcName;
        sayData.type=SayType.Npc;
        sayData.player=player;
        if (!SceneItemManager.instance.GetNpcData(npcName))
        {
            sayData=sayData6;
        }
        PanelManager.Open<SayPanel>(sayData);

        //关闭碰撞enable
        collObj.GetComponent<Collider2D>().enabled = false;
    }
}
